package com.situ.mall.controller;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/page")
public class PageController {

    @RequestMapping("/**")
    public String path(HttpServletRequest request) {
        String requestURI = request.getRequestURI();
        System.out.println("requestURI:"+requestURI);
        String[] paths = requestURI.split("/");
        if(paths.length==3) {
            return paths[2];
        }
        else if(paths.length==4) {
            return paths[2]+"_"+paths[3];
        }
        else {
            return "index";
        }
    }
}
